package com.xq.shop.po;


import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

@Entity
@Table(name="product")
public class Product implements Serializable {

	private static final long serialVersionUID = 2434635021737235661L;
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Long id;
	private String code;
	private String name;
	private String title;
	private Integer category;
	private Double market_price;
	private Double price;
	private Double enter_price;
	private Long count;
	private String content;
	private Integer is_marketable;
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(updatable=false)
	private Date create_date = new Date();
	
	@Temporal(TemporalType.TIMESTAMP)
	private Date modify_date = new Date();
	
	@OneToMany(fetch=FetchType.LAZY)
	@Cascade(CascadeType.SAVE_UPDATE)
	@JoinColumn(name="product_code", referencedColumnName="code")
	private List<ProductImage> images = new ArrayList<ProductImage>();
	
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Integer getCategory() {
		return category;
	}
	public void setCategory(Integer category) {
		this.category = category;
	}
	public Double getMarket_price() {
		return market_price;
	}
	public void setMarket_price(Double marketPrice) {
		market_price = marketPrice;
	}
	public Double getPrice() {
		return price;
	}
	public void setPrice(Double price) {
		this.price = price;
	}
	public Double getEnter_price() {
		return enter_price;
	}
	public void setEnter_price(Double enterPrice) {
		enter_price = enterPrice;
	}
	public Long getCount() {
		return count;
	}
	public void setCount(Long count) {
		this.count = count;
	}
	public Integer getIs_marketable() {
		return is_marketable;
	}
	public void setIs_marketable(Integer isMarketable) {
		is_marketable = isMarketable;
	}
	public Date getCreate_date() {
		return create_date;
	}
	public void setCreate_date(Date createDate) {
		create_date = createDate;
	}
	public Date getModify_date() {
		return modify_date;
	}
	public void setModify_date(Date modifyDate) {
		modify_date = modifyDate;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public List<ProductImage> getImages() {
		return images;
	}
	public void setImages(List<ProductImage> images) {
		this.images = images;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
}